package com.xxtx.trade.agent.mapper;



import com.xxtx.trade.agent.bean.TradeSysAgent;
import com.xxtx.trade.agent.dto.ImeiToPhoneDto;
import com.xxtx.trade.sysUser.bean.UrlInfosBaidu;
import com.xxtx.trade.sysUser.bean.UrlInfosKuaiShou;
import com.xxtx.trade.sysUser.bean.UrlInfosTencent;
import com.xxtx.trade.sysUser.bean.UrlInfos;
import com.xxtx.trade.sysUser.dto.*;
import com.xxtx.trade.wx.bean.TradeWxUser;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Map;

@Mapper
public interface TradeSysAgentMapper {

    int deleteByPrimaryKey(String id);

    int insert(TradeSysAgent record);

    int insertSelective(TradeSysAgent record);

    TradeSysAgent selectByPrimaryKey(String id);

    int updateByPrimaryKeySelective(TradeSysAgent record);

    int updateByPrimaryKey(TradeSysAgent record);

    /**
     * 根据登录用户id 查询agent
     * @param id
     * @return
     */
    TradeSysAgent selectAgentByAccountId(String id);

    void updateSmsState(TradeSysUserDto dto);

    List<Integer> selectSmsPower(@Param("list") ArrayList<Object> list);


    List<Map<String, Object>> agentListOption(Map<String, Object> parmas);

    /**根据id查询下级代理*/
    List<Map<String, String>> queryAgentIdById(@Param("id")String id);

    /**根据id查询下级代理是否还存在sim卡*/
    int queryAgentSimCountById(@Param("id")String id);

    /**根据id删除账户*/
    int deleteAccountById(@Param("id")String id);

    int selectIsMySimByIntoNo(@Param("agentPathId") String agentPathId, @Param("iccid") String iccid);


    void insertUpdateVoiceLog(@Param("list") List<Map<String, Object>> list);

    void updateVoiceState(@Param("id") String id, @Param("success") int success, @Param("fail") int fail);


    List<String> selectrelainlist(String agentId);

    List<String> selectAgentIdsByPathIds(@Param("agentPathId") String agentPathId);

    TradeWxUser selectSysWxUserByIccid(String iccid);

    String selectnameBYiccid(String iccid);

    String selecticcidByIntoNo(String iccid);

    String selectMEailByAgentId(String agentId);

    void updateAGentEmails(@Param("id") String id, @Param("emails") String emails);

    String selectEmails(String id);

    String selectSysConfigBYTitls(String title);

    String selectNameByAgentId(String nextAgentId);


    List<Map<String, Object>> selectDownLoadSim(TradeSysUserDto dto);

    void insertDownLog(Map<String, Object> map);

    void updateExporeByid(Map<String, Object> hashMap);

    List<TradeSysAgent> selectQueryList(TradeSysUserDto dto);

    List<TradeSysAgent> selectAgentQueryListByCreateUserId(TradeSysUserDto dto);

    List<Map<String, Object>> tiktokList(TradeSysRoleDto dto);

    Map<String, Object> yesterdayCount(String urlId,String date);

    List<Map<String, Object>> tiktokInfoList(TradeSysRoleDto dto);

    List<Map<String, Object>> tencentInfoList(TencentInfoDto dto);

    List<Map<String, Object>> baiduInfoList(BaiDuInfoDto dto);

    List<Map<String, Object>> kuaishouInfoList(KuaiShouInfoDto dto);

    Integer selectCountUrlInfo(String rul);

    void tiktokInsert(@Param("id") String id, @Param("name") String name, @Param("urlNote") String urlNote, @Param("urlInfo") String urlInfo,
                      @Param("urlType") String urlType, @Param("agentId") String agentId, @Param("agentName") String agentName);

    Integer selectCountUrlInfoNoId(@Param("url") String url, @Param("id") String id);

    void tiktokUpdate(@Param("id") String id, @Param("urlNote") String urlNote, @Param("url") String url, @Param("totalSize") Integer totalSize,
                      @Param("urlType") String urlType, @Param("name") String name);

    void updateUrlNameById(@Param("id") String id, @Param("name") String name);

    List<Map<String, Object>> selectAlltiktokUrls();

    List<TradeSysRoleDto> selectPermissionTiktokUrls(TradeSysRoleDto dto);

    List<Map<String, Object>> selectNearlyClickUrls();

    List<Map<String, Object>> selectNearlyClickAgentUrls();

    Integer selectCountAllUrlsBy(TradeSysRoleDto form);

    Integer selectCountAllTencentUrlsBy(TradeSysRoleDto form);// 获取数据量

    Integer selectCountAllBaiduUrlsBy(TradeSysRoleDto form);// 获取数据量

    Integer selectCountAllKSUrlsBy(TradeSysRoleDto form);// 获取数据量

    List<UrlInfos> selectExcelUrlInfos(TradeSysRoleDto tradeSysRoleDto);

    List<UrlInfosTencent> selectExcelUrlInfosTencent(TencentInfoDto tencentInfoDto);

    List<UrlInfosBaidu> selectExcelUrlInfosBaidu(BaiDuInfoDto baiDuInfoDto);

    List<UrlInfosKuaiShou> selectExcelUrlInfosKuaiShou(KuaiShouInfoDto kuaiShouInfoDto);

    Map<String, Object> selectUrlMapByUrlNote(String myName);

    List<Map<String, Object>> selectAllUrlNote();

    Integer selectCountImeiBy(String imei);

    void insertDouYingData(@Param("imei") String imei, @Param("idfa") String idfa, @Param("oaid") String oaid, @Param("oaid_md5") String oaid_md5, @Param("campaign_name") String campaign_name, @Param("urlId") String urlId, @Param("urlName") String urlName, @Param("agentId") String agentId, @Param("agentName") String agentName);

    void batchInsertDouYinData(List<tiktokInfoDto> dtos);//

    void batchInsertTencentData(List<TencentInfoDto> dtos);

    void batchInsertBaiDuData(List<BaiDuInfoDto> dtos);

    void batchInsertKuaiShouData(List<KuaiShouInfoDto> dtos);

    void insertShiPinHaoData(TencentInfoDto dto);

    void updateAddOneByUrlId(String urlId);

    Integer selectUrlLog(String log, String date);

    Integer selectTencentUrlLog(String log, String date);

    void InsertUrlLog(String log, String date);

    void InsertTencentUrlLog(String log, String date);

    Integer selectCountSizeByDate(Date date);

    Integer selectSizeByDate(Date date);

    Integer selectCountSizeByDateCondition(String date, String urlId);

    void insertCountSizeByDateCondition(@Param("time") String time, @Param("count") String count, @Param("urlId") String urlId, @Param("agentId") String agentId, @Param("createTime")Date createTime);

    List<Map<String, Object>> selectDataList();


    List<Map<String, Object>> selectTopList();


    /**
     * wzyk新增：
     * */
    // 按imei查询phone
    ImeiToPhoneDto selectImei(String imei);


    String selectAccountNameByAccountIdString (TradeSysAgent tradeSysAgent);


    List<Map<String, Object>> selectCountDataConditionAgentId(@Param("agentId") String agentId, @Param("startTime") String startTime);

    List<Map<String, Object>> selectCountDataConditionUrlId(@Param("urlId") String urlId, @Param("startTime") String startTime);
    List<Map<String, Object>> selectCountDataNoCondition(@Param("startTime") String startTime);

    List<ImeiToPhoneDto> selectImeiList();

    List<ImeiToPhoneDto> selectImeiList2(List<String> imeiList);

    /**
     * 抖音爬取记录
     * */
    void insertTiktokPlaywrightCommentLog(PlaywrightCommentLogDto playwrightCommentLogDto);

    PlaywrightUserDto selectPlaywrightUser(PlaywrightUserDto playwrightUserDto);

    void updatePlaywrightUser(PlaywrightUserDto playwrightUserDto);

    void addTiktokPlaywrightUser(PlaywrightUserDto playwrightUserDto);

    void InsertTiktokPlaywrightComment(PlaywrightCommentDto playwrightCommentDto);

    void deleteExpiredUrlLog(String date);

    void deleteExpiredTencentUrlLog(String date);

}